package com.sinosoft.perfect.system._.dao;

import java.sql.SQLException;

import com.sinosoft.perfect.common.system.BaseSqlSessionDaoSupport;
import com.sinosoft.perfect.system._.MapperSystem;
import com.sinosoft.perfect.system._.vo.SortNumber;

public class SortNumberDaoImpl extends BaseSqlSessionDaoSupport implements ISortNumberDao {

	private MapperSystem getMapperSystem() {
		return getSqlSession().getMapper(MapperSystem.class);
	}

	@Override
	public SortNumber selectSortHisoryInfo(SortNumber sortNumberParam) throws SQLException {
		return getMapperSystem().selectSortHisoryInfo(sortNumberParam);
	}

	@Override
	public void updateSort(SortNumber sortNumber) throws SQLException {
		getMapperSystem().updateSort(sortNumber);
	}

	@Override
	public void updateSortDown(SortNumber sortNumber) throws SQLException {
		getMapperSystem().updateSortDown(sortNumber);
	}

	@Override
	public void updateSortUp(SortNumber sortNumber) throws SQLException {
		getMapperSystem().updateSortUp(sortNumber);
	}

	public void updateSortTransaction(SortNumber sortNumber, boolean up) throws SQLException {
		if (up) {
			getMapperSystem().updateSortUp(sortNumber);
		} else {
			getMapperSystem().updateSortDown(sortNumber);
		}
		getMapperSystem().updateSort(sortNumber);
	}

	@Override
	public SortNumber selectSortHisoryInfoRelation(SortNumber sortNumber) throws SQLException {
		return getMapperSystem().selectSortHisoryInfoRelation(sortNumber);
	}

	@Override
	public void updateSortRelation(SortNumber sortNumber) throws SQLException {
		getMapperSystem().updateSortRelation(sortNumber);
	}

	@Override
	public void updateSortUpRelation(SortNumber sortNumber) throws SQLException {
		getMapperSystem().updateSortUpRelation(sortNumber);
	}

	@Override
	public void updateSortDownRelation(SortNumber sortNumber) throws SQLException {
		getMapperSystem().updateSortDownRelation(sortNumber);
	}

	@Override
	public void updateSortTransactionRelation(SortNumber sortNumber, boolean up) throws SQLException {
		if (up) {
			getMapperSystem().updateSortUpRelation(sortNumber);
		} else {
			getMapperSystem().updateSortDownRelation(sortNumber);
		}
		getMapperSystem().updateSortRelation(sortNumber);
	}

	@Override
	public SortNumber selectSortHisoryInfoNoSuper(SortNumber sortNumber) throws SQLException {
		return getMapperSystem().selectSortHisoryInfoNoSuper(sortNumber);
	}

	@Override
	public void updateSortNoSuper(SortNumber sortNumber) throws SQLException {
		getMapperSystem().updateSortNoSuper(sortNumber);
	}

	@Override
	public void updateSortUpNoSuper(SortNumber sortNumber) throws SQLException {
		getMapperSystem().updateSortUpNoSuper(sortNumber);
	}

	@Override
	public void updateSortDownNoSuper(SortNumber sortNumber) throws SQLException {
		getMapperSystem().updateSortDownNoSuper(sortNumber);
	}

	@Override
	public void updateSortTransactionNoSuper(SortNumber sortNumber, boolean up) throws SQLException {
		if (up) {
			getMapperSystem().updateSortUpNoSuper(sortNumber);
		} else {
			getMapperSystem().updateSortDownNoSuper(sortNumber);
		}
		getMapperSystem().updateSortNoSuper(sortNumber);
	}

}
